cmake_minimum_required(VERSION 3.12)

project(mc64 LANGUAGES Fortran)

# Set Fortran compiler flags (match Makefile)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -O3")

# List source files (respect Makefile order)
set(MC64_SOURCES
    ddeps90.f90
    common90.f90
    common.f
    hsl_mc64d.f
    hsl_mc64d_ciface.f
)

# Create static library
add_library(mc64 STATIC ${MC64_SOURCES})

# Include path for Fortran modules (optional: if you want to use ../include)
target_include_directories(mc64 PUBLIC
    ${CMAKE_CURRENT_SOURCE_DIR}/../include
)

# Export .mod files to a known directory (optional)
set_target_properties(mc64 PROPERTIES
    Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
